package javafx.com;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

/**
 * @Classname main
 * @Date 2021/09/20 10:49
 * @Author by yx
 * @Description :
 */
public class main extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {

        AnchorPane a1 = new AnchorPane();
        a1.setPrefWidth(100);
        a1.setPrefHeight(100);
        a1.setStyle("-fx-background-color: #EE6AA7");

        AnchorPane a2 = new AnchorPane();
        a2.setPrefWidth(100);
        a2.setPrefHeight(100);
        a2.setStyle("-fx-background-color: #98FB98");

        AnchorPane a3 = new AnchorPane();
        a3.setPrefWidth(100);
        a3.setPrefHeight(100);
        a3.setStyle("-fx-background-color: #A0522D");

        AnchorPane a4 = new AnchorPane();
        a4.setPrefWidth(100);
        a4.setPrefHeight(100);
        a4.setStyle("-fx-background-color: #1E90FF");

        AnchorPane a5 = new AnchorPane();
        a5.setPrefWidth(100);
        a5.setPrefHeight(100);
        a5.setStyle("-fx-background-color: #EEEE00");

        BorderPane borderPane = new BorderPane();
        borderPane.setStyle("-fx-background-color: #B23AEE");

        // 若控件没有宽高度,会被其它控件占据位置,center的优先级最高
        borderPane.setTop(a1);
        borderPane.setBottom(a2);
        borderPane.setLeft(a3);
        borderPane.setRight(a4);
        borderPane.setCenter(a5);

        Scene scene = new Scene(borderPane);

        primaryStage.setScene(scene);
        primaryStage.setWidth(800);
        primaryStage.setHeight(800);
        primaryStage.setTitle("javafx");
        primaryStage.show();


    }
}
